<?php

namespace app\mall\ui\form;

use app\mall\enum\YesNoEnum;

/**
 * 店员管理表单
 */
class MallStoreClerkForm
{
    public function store_id()
    {
        return [
            'type' => 'number',
            'col' => ['span' => 12],
            'title' => '门店',
            'field' => 'store_id',
            'validate' =>
                [
                    [
                        'required' => true,
                        'message' => '不能为空',
                    ],
                ],
        ];
    }

    public function uid()
    {
        return [
            'type' => 'number',
            'col' => ['span' => 12],
            'title' => '会员',
            'field' => 'uid',
            'validate' =>
                [
                    [
                        'required' => true,
                        'message' => '不能为空',
                    ],
                ],
        ];
    }

    public function avatar()
    {
        return [
            'type' => 'uploadImage',
            'col' => ['span' => 12],
            'action' => config('thinkAdmin.upload_url'),
            'title' => '头像',
            'field' => 'avatar',
            'validate' =>
                [
                    [
                        'required' => true,
                        'message' => '不能为空',
                    ],
                ],
        ];
    }

    public function wx_account_qrcode()
    {
        return [
            'type' => 'uploadImage',
            'col' => ['span' => 12],
            'action' => config('thinkAdmin.upload_url'),
            'title' => '微信二维码',
            'field' => 'wx_account_qrcode',
        ];
    }

    public function shopowner()
    {
        return [
            'type' => 'radio',
            'col' => ['span' => 12],
            'options' => YesNoEnum::toZhArrayForSelect(),
            'title' => '是否店长',
            'field' => 'shopowner',
            'value' => YesNoEnum::getNo()
        ];
    }

    public function wx_account()
    {
        return [
            'type' => 'input',
            'col' => ['span' => 12],
            'title' => '微信号',
            'field' => 'wx_account',
        ];
    }

    public function name()
    {
        return [
            'type' => 'input',
            'col' => ['span' => 12],
            'title' => '姓名',
            'field' => 'name',
            'validate' =>
                [
                    [
                        'required' => true,
                        'message' => '不能为空',
                    ],
                ],
        ];
    }

    public function phone()
    {
        return [
            'type' => 'input',
            'col' => ['span' => 12],
            'title' => '电话',
            'field' => 'phone',
            'validate' => [
                [
                    'required' => true,
                    'message' => '不能为空',
                ],
                [
                    'pattern' => '^1[0-9]\d{9}$',
                    'message' => '手机号格式错误',
                ],
            ],
        ];
    }

    public function achievement()
    {
        return [
            'type' => 'input',
            'col' => ['span' => 12],
            'title' => '销售业绩',
            'field' => 'achievement',
        ];
    }

    public function slogan()
    {
        return [
            'type' => 'input',
            'col' => ['span' => 12],
            'title' => '服务口号',
            'field' => 'slogan',
        ];
    }

}